1. Field of the Invention
Methods and apparatuses consistent with the present invention generally relate to storing and restoring a state of a virtual machine operating on a virtual machine monitor, and more particularly, to a method and apparatus for storing and restoring the state of the virtual machine while minimizing time consumption.
2. Description of the Related Art
Hardware platforms based on a general-purpose central processing unit (CPU) are originally designed to run a single operating system (OS). However, a computer running a single OS can use only about 5-10% of total maximum hardware performance instead of using the total maximum hardware performance itself.
Inefficiency in using hardware becomes more serious for business servers. Such inefficiency increases information technology (IT) costs of businesses. To solve this problem, virtual techniques for allowing a plurality of OSs to share hardware resources have been steadily developed.
One of techniques for providing a plurality of identical execution environments within a single hardware platform is a virtual machine monitor. The virtual machine monitor creates a plurality of virtual machines that operate independently in single hardware and allows the plurality of virtual machines to share hardware resources. Each of the virtual machines is a virtualized system that runs its own OS and is an independent object that is not affected by another virtual machine on the virtual machine monitor, as will be described in detail with reference to FIGS. 1A and 1B.
FIGS. 1A and 1B illustrate a virtual machine monitor and virtual machines according to the related art.
Referring to FIG. 1A, a virtual machine monitor 112 virtualizes hardware resources of a hardware platform A 110 in order to allow a plurality of first and second virtual machines 114 and 116 to share the hardware resources of the hardware platform A 110. The first and second virtual machines 114 and 116 are independent objects and run independent OSs by using the virtualized hardware resources.
The OSs that are run on the first and second virtual machines 114 and 116 request the virtual machine monitor 112 to grant an access to the hardware platform A 110, and the virtual machine monitor 112 relays the first and second virtual machines 114 and 116 to the hardware platform A 110. In a system that does not implement the virtual machine monitor 112, the OSs of the first and second virtual machines 114 and 116 can directly access to the hardware platform A 110. However, in a system that implements the virtual machine monitor 112, the OSs of the first and second virtual machines 114 and 116 can access to the hardware platform A 110 only through the virtual machine monitor 112.
FIG. 1B illustrates a case where the second virtual machine 116 operating in the hardware platform A 110 is moved to a hardware platform B 120. In order to move the second virtual machine 116 operating in the hardware platform A 110, as illustrated in FIG. 1A, to the hardware platform B 120 as illustrated in FIG. 1B, a state of the second virtual machine 116 in the hardware platform A 110 has to be stored and then be restored in the hardware platform B 120.
The stored and then restored state of the second virtual machine 116 may include a CPU register state and a device register state in the hardware platform A 110, and data stored in a system memory that has been allocated to the second virtual machine 116 by the virtual machine monitor 112 and has been used by the second virtual machine 116.
According to the related art, the state of the second virtual machine 116 in the hardware platform A 110 is first stored in a predetermined storage device and then is restored in the hardware platform B 120.
However, since the CPU register state, the device register state, and the data stored in the system memory are collectively stored and then restored according to the related art, too much time is consumed in storing and restoring the state of the second virtual machine 116. Moreover, if a memory size of the hardware platform B 120 in which the state of the second virtual machine 116 is to be restored is smaller than that of the hardware platform A 110, the state of the second virtual machine 116 cannot be restored.
Therefore, there is a need for a method and apparatus for storing and restoring a state of a virtual machine while minimizing time delay in moving the virtual machine to different hardware.